<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace builder\tab\util\titem;

/**
 * 自定义项
 * @author cleverstone
 * @since ym2.0
 */
class Custom extends TabItemType
{
    /**
     * @return string
     */
    protected function name()
    {
        return 'tab_item_custom';
    }

    /**
     * @param string $jsProperty 脚本切换属性,即: window.ym2BehaviorReqExport对象下的方法名
     * @return $this
     */
    public function switchReloadProperty($jsProperty)
    {
        $this->reloadProperty = (string)$jsProperty;
        return $this;
    }

    /**
     * @return array
     */
    public function _toArray()
    {
        return [
            'id' => $this->id,
            'content' => $this->content,
            'selected' => $this->selected,
            'reloadProperty' => $this->reloadProperty,
        ];
    }
}